package org.penguin.boot.security.dto;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.validator.constraints.Length;
import org.penguin.boot.security.validation.annotation.PasswordValueMatch;
import org.penguin.boot.security.validation.annotation.ValidPassword;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import java.io.Serial;
import java.io.Serializable;

/**
 * @author : cyhch
 * @version : 1.0
 * @createdTime : 2023/12/19 20:28
 * @since : 1.0
 */
@Getter
@Setter
@PasswordValueMatch.List({
        @PasswordValueMatch(
                field = "password",
                fieldMatch = "confirmPassword",
                message = "密码和确认密码不一致！"
        ),
})
public class UserDto implements Serializable {

    @Serial
    private static final long serialVersionUID = -183237901953067280L;

    @NotBlank(message = "Email不能为空！")
    @Length(min = 10, max = 64, message = "Email最少10个字符，最多64个字符！")
    @Email(message = "请输入有效的Email地址！")
    private String email;

    @NotBlank(message = "密码不能为空！")
    @ValidPassword
    private String password;

    @NotBlank(message = "确认密码不能为空！")
    @ValidPassword
    private String confirmPassword;

    @NotBlank(message = "昵称不能为空！")
    private String nickName;
}
